<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test6</title>
</head>
<body>
</body>
<script>
    //1.创建对象
    // let object1 = {
    //     id : 1,
    //     name :  "九转苍翎",
    //     height : 174,
    //     weight : 120,
    //     F1 : function(){
    //         console.log("Hello World");
    //     }
    // }
    // console.log(object1.id);
    // console.log(object1["name"]);
    // console.log(object1["height"]);
    // console.log(object1["weight"]);
    // object1.F1();

    // let object2 = new Object();
    // object2.name = "九转苍翎";
    // object2.height = 174;
    // object2.F1 = function(){
    //     console.log("Hello World");
    // }
    // console.log(object2.name);
    // console.log(object2.height);
    // object2.F1();

    // let object3 = {};
    // object3.name = "九转苍翎";
    // object3.height = 174;
    // object3.F1 = function(){
    //     console.log("Hello World");
    // }
    // console.log(object3.name);
    // console.log(object3.height);
    // object3.F1();

    //2.构造函数
    // let people = function(name,age){
    //     this.name = name;
    //     this.age = age;
    //     this.F1 = function(){
    //         console.log(this.name + ":" + "Hello World");
    //     }
    // }
    // let 九转苍翎 = new people("九转苍翎",18);
    // let 逆天而行 = new people("逆天而行",18);
    // console.log(九转苍翎);
    // 九转苍翎.F1();
    // console.log(逆天而行);
    // 逆天而行.F1();

    //3.class&constructor
    class People{
        constructor(name,age){
            this.name = name;
            this.age = age;
        }
        F1(){
            console.log(this.name + ":" + "Hello World");
        }
        static classroom = 101;
        static F2(){
            console.log(this.classroom);
        }
    }
    // let 九转苍翎 = new People("九转苍翎",18);
    // console.log(九转苍翎);
    // 九转苍翎.F1();
    // let 逆天而行 = new People("逆天而行",18);
    // console.log(逆天而行);
    // 逆天而行.F1();
    // console.log(People.classroom);
    // People.F2();

    //4.继承:extends
    class Student extends People{
        constructor(name,age,id){
            super(name,age);
            this.id = id;
        }
        F1(){
            alert(this.name + ":" + "Hello World");
        }
    }
    let 九转苍翎 = new Student("九转苍翎",18,1);
    console.log(九转苍翎);
    九转苍翎.F1();
</script>
</html>